var outerLayout;
define(["layout"],function(){
//	layoutSettings_Inner = {
//		applyDefaultStyles : true, // basic styling for testing & demo purposes
//		minSize : 20, // TESTING ONLY
//		spacing_closed : 14,
//		north__spacing_closed : 8,
//		south__spacing_closed : 8,
//		north__togglerLength_closed : -1, // = 100% - so cannot 'slide open'
//		south__togglerLength_closed : -1,
//		fxName : "slide", // do not confuse with "slidable" option!
//		fxSpeed_open : 1000,
//		fxSpeed_close : 2500,
//		fxSettings_open : {
//			easing : "easeInQuint"
//		},
//		fxSettings_close : {
//			easing : "easeOutQuint"
//		},
//		north__fxName : "none",
//		south__fxName : "drop",
//		south__fxSpeed_open : 500,
//		south__fxSpeed_close : 1000,
//		center__minWidth : 200,
//		center__minHeight : 200
//	};

	var layoutSettings_Outer = {
		name : "outerLayout",
		defaults : {
			size : "auto",
			minSize : 50,
			paneClass : "pane", // default = 'ui-layout-pane'
			resizerClass : "resizer", // default = 'ui-layout-resizer'
			togglerClass : "toggler", // default = 'ui-layout-toggler'
			buttonClass : "button", // default = 'ui-layout-button'
			contentSelector : ".content", // inner div to auto-size so only it
											// scrolls, not the entire pane!
			contentIgnoreSelector : "span", // 'paneSelector' for content to 'ignore' when measuring room for content
			togglerLength_open : 35, // WIDTH of toggler on north/south edges - HEIGHT on east/west edges
			togglerLength_closed : 35 ,// "100%" OR -1 = full height
			hideTogglerOnSlide : true ,// hide the toggler when pane is 'slid  open'
			togglerTip_open : "Close This Pane",
			togglerTip_closed : "Open This Pane",
			resizerTip : "Resize This Pane",
			// effect defaults - overridden on some panes
			fxName : "slide", // none, slide, drop, scale
			fxSpeed_open : 750,
			fxSpeed_close : 1500,
			fxSettings_open : {
				easing : "easeInQuint"
			},
			fxSettings_close : {
				easing : "easeOutQuint"
			}
		},
		north : {
			spacing_open : 5,
			spacing_closed : 5,
			resizable : false, // 是否可调整大小
			slidable : true,
			fxName : "none"
		},
		south : {
			maxSize : 200,
			spacing_open : 5,
			spacing_closed : 5, // HIDE resizer & toggler when 'closed'
			slidable : true ,// REFERENCE - cannot slide if spacing_closed = 0
			resizable : false ,// 是否可调整大小
			initClosed : false
		},
		west : {
			size : 250,
			spacing_closed : 21, // wider space when closed
			togglerLength_closed : 21, // make toggler 'square' - 21x21
			togglerAlign_closed : "top", // align to top of resizer
			togglerLength_open : 0 ,// NONE - using custom togglers INSIDE west-pane
			togglerTip_open : "Close West Pane",
			togglerTip_closed : "Open West Pane",
			resizerTip_open : "Resize West Pane",
			slideTrigger_open : "click", // default
			initClosed : false, // add 'bounce' option to default 'slide' effect
			fxSettings_open : {
				easing : "easeOutBounce"
			}
		},
		east : {
			size : 250,
			spacing_closed : 21, // wider space when closed
			togglerLength_closed : 21, // make toggler 'square' - 21x21
			togglerAlign_closed : "top", // align to top of resizer
			togglerLength_open : 0, // NONE - using custom togglers INSIDE east-pane
			togglerTip_open : "Close East Pane",
			togglerTip_closed : "Open East Pane",
			resizerTip_open : "Resize East Pane",
			slideTrigger_open : "mouseover",
			initClosed : false,
			// override default effect, speed, and settings
			fxName : "drop",
			fxSpeed : "normal",
			fxSettings : {
				easing : ""
			}
		},
		center : {
			paneSelector : "#mainContent", // sample: use an ID to select pane instead of a class
			minWidth : 200,
			minHeight : 200
		}
	};
	
	var render = function() {
		// create the OUTER LAYOUT
		outerLayout = $("body").layout(layoutSettings_Outer);
		// save selector strings to vars so we don't have to repeat it
		// must prefix paneClass with "body > " to target ONLY the outerLayout
		// panes
		var westSelector = "body > .ui-layout-west"; // outer-west pane
		var eastSelector = "body > .ui-layout-east"; // outer-east pane

		// CREATE SPANs for pin-buttons - using a generic class as identifiers
		$("<span></span>").addClass("pin-button").prependTo(westSelector);
		$("<span></span>").addClass("pin-button").prependTo(eastSelector);
		// BIND events to pin-buttons to make them functional
		outerLayout.addPinBtn(westSelector + " .pin-button", "west");
		outerLayout.addPinBtn(eastSelector + " .pin-button", "east");

		// CREATE SPANs for close-buttons - using unique IDs as identifiers
		$("<span></span>").attr("id", "west-closer").prependTo(westSelector);
		$("<span></span>").attr("id", "east-closer").prependTo(eastSelector);
		// BIND layout events to close-buttons to make them functional
		outerLayout.addCloseBtn("#west-closer", "west");
		outerLayout.addCloseBtn("#east-closer", "east");
	};
	
	//手风琴
	$(document).ready(function() {
		var accordion_head = $('.accordion > li > a'),
			accordion_body = $('.accordion li > .sub-menu');
		//默认展开第一个
		accordion_head.first().addClass('active').next().slideDown('normal');
		accordion_head.on('click', function(event) {
			// 禁用头部链接
			event.preventDefault();
			// 单击选项卡上显示和隐藏
			if ($(this).attr('class') != 'active'){
				accordion_body.slideUp('normal');
				$(this).next().stop(true,true).slideToggle('normal');
				accordion_head.removeClass('active');
				$(this).addClass('active');
			}
		});
	});
	
	return {
		render: render
	};
});